var app=angular.module("huabote",['ui.router','ui.bootstrap','ngCookies','ui.select','ngSanitize','ngCookies'])
app.config(function($stateProvider,$urlRouterProvider){
	$urlRouterProvider.when("","/index");
	$stateProvider.state("index",{
		url:"/index",
		templateUrl:"../view/home/index.html",
		controller:"index",
	})
	$stateProvider.state("notice",{
		url:"/notice",
		templateUrl:"../view/notice/index.html",
		controller:"notice",
	})
	$stateProvider.state("notice.broadcast",{
		url:"/broadcast",
		templateUrl:"../view/notice/notice.html",
		controller:"broadcast",
	})
	$stateProvider.state("notice.sendEmail",{
		url:"/sendEmail",
		templateUrl:"../view/notice/sendEmail.html",
		controller:"sendEmail",
	})
	$stateProvider.state("notice.receiveBox",{
		url:"/receiveBox",
		templateUrl:"../view/notice/receiveBox.html",
		controller:"receiveBox",
	})
	$stateProvider.state("notice.sendBox",{
		url:"/sendBox",
		templateUrl:"../view/notice/sendBox.html",
		controller:"sendBox",
	})
	$stateProvider.state("noticeDetail",{
		url:"/noticeDetail/:id",
		templateUrl:"../view/notice/noticeDetail.html",
		controller:"noticeDetail",
	})
	$stateProvider.state("notice.receiveEmailDetail",{
		url:"/receiveEmailDetail/:id",
		templateUrl:"../view/notice/receiveEmailDetail.html",
		controller:"emailDetail",
	})
	$stateProvider.state("notice.sendEmailDetail",{
		url:"/sendEmailDetail/:id",
		templateUrl:"../view/notice/sendEmailDetail.html",
		controller:"emailDetail",
	})
	$stateProvider.state("user",{
		url:"/user",
		templateUrl:"../view/userInfo/index.html",
		controller:"userInfo",
	})
	$stateProvider.state("user.userInfo",{
		url:"/userInfo",
		templateUrl:"../view/userInfo/userInfo.html",
		controller:"userInfo",
	})
	$stateProvider.state("user.password",{
		url:"/password",
		templateUrl:"../view/userInfo/password.html",
		controller:"password",
	})
	$stateProvider.state("user.score",{
		url:"/score",
		templateUrl:"../view/userInfo/score.html",
		controller:"score",
	})
	$stateProvider.state("teachPlan",{
		url:"/teachPlan",
		templateUrl:"../view/teachPlan/index.html",
		controller:"teachPlan",
	})
	$stateProvider.state("teachPlan.courseSelect",{
		url:"/courseSelect",
		templateUrl:"../view/teachPlan/courseSelect.html",
		controller:"courseSelect",
	})
	$stateProvider.state("teachPlan.scoreComponent",{
		url:"/scoreComponent",
		templateUrl:"../view/teachPlan/scoreComponent.html",
		controller:"scoreComponent",
	})
	$stateProvider.state("teachPlan.examArrange",{
		url:"/examArrange",
		templateUrl:"../view/teachPlan/examArrange.html",
		controller:"examArrange",
	})
	$stateProvider.state("course",{
		url:"/course",
		templateUrl:"../view/course/index.html",
		controller:"course",
	})
	$stateProvider.state("course.courseStudy",{
		url:"/courseStudy",
		templateUrl:"../view/course/courseStudy.html",
		controller:"courseStudy",
	})
	$stateProvider.state("course.wareView",{
		url:"/wareView/:courseId/:wareId",
		templateUrl:"../view/course/wareView.html",
		controller:"wareView",
	})
	$stateProvider.state("course.courseLive",{
		url:"/courseLive",
		templateUrl:"../view/course/courseLive.html",
		controller:"courseLive",
	})
	$stateProvider.state("course.liveRoom",{
		url:"/liveRoom/:id",
		templateUrl:"../view/course/liveRoom.html",
		controller:"liveRoom",
	})
	$stateProvider.state("course.coursework",{
		url:"/coursework",
		templateUrl:"../view/course/coursework.html",
		controller:"coursework",
	})
	$stateProvider.state("course.courseworkDetail",{
		url:"/courseworkDetail/:id",
		templateUrl:"../view/course/courseworkDetail.html",
		controller:"courseworkDetail",
	})
	$stateProvider.state("course.question",{
		url:"/question",
		templateUrl:"../view/course/question.html",
		controller:"question",
	})
	$stateProvider.state("course.question.allQuestion",{
		url:"/allQuestion",
		templateUrl:"../view/course/allQuestion.html",
		controller:"allQuestion",
	})
	$stateProvider.state("course.question.creamQuestion",{
		url:"/creamQuestion",
		templateUrl:"../view/course/creamQuestion.html",
		controller:"creamQuestion",
	})
	$stateProvider.state("course.question.myQuestion",{
		url:"/myQuestion",
		templateUrl:"../view/course/myQuestion.html",
		controller:"myQuestion",
	})
	$stateProvider.state("course.question.askQuestion",{
		url:"/askQuestion",
		templateUrl:"../view/course/askQuestion.html",
		controller:"askQuestion",
	})
	$stateProvider.state("course.question.questionDetail",{
		url:"/questionDetail/:id",
		templateUrl:"../view/course/questionDetail.html",
		controller:"questionDetail",
	})
	$stateProvider.state("course.examPrepare",{
		url:"/examPrepare",
		templateUrl:"../view/course/examPrepare.html",
		controller:"examPrepare",
	})
	
	$stateProvider.state("pay",{
		url:"/pay",
		templateUrl:"../view/pay/index.html",
		controller:"pay",
	})
	$stateProvider.state("pay.paymentInfo",{
		url:"/paymentInfo",
		templateUrl:"../view/pay/paymentInfo.html",
		controller:"paymentInfo",
	})
	$stateProvider.state("pay.paymentSheet",{
		url:"/paymentSheet",
		templateUrl:"../view/pay/paymentSheet.html",
		controller:"paymentSheet",
	})
	$stateProvider.state("thesis",{
		url:"/thesis",
		templateUrl:"../view/thesis/index.html",
		controller:"thesis",
	})
	$stateProvider.state("thesis.thesisSubmit",{
		url:"/thesisSubmit",
		templateUrl:"../view/thesis/thesisSubmit.html",
		controller:"thesis",
	})
	$stateProvider.state("thesis.thesisSubmit.topicSelect",{
		url:"/topicSelect",
		templateUrl:"../view/thesis/topicSelect.html",
		controller:"topicSelect",
	})
	$stateProvider.state("thesis.thesisSubmit.thesisOutline",{
		url:"/thesisOutline",
		templateUrl:"../view/thesis/thesisOutline.html",
		controller:"thesisOutline",
	})
	$stateProvider.state("thesis.thesisSubmit.firstDraft",{
		url:"/firstDraft",
		templateUrl:"../view/thesis/firstDraft.html",
		controller:"firstDraft",
	})
	$stateProvider.state("thesis.thesisSubmit.finalDraft",{
		url:"/finalDraft",
		templateUrl:"../view/thesis/finalDraft.html",
		controller:"finalDraft",
	})
	$stateProvider.state("thesis.thesisDefense",{
		url:"/thesisDefense",
		templateUrl:"../view/thesis/thesisDefense.html",
		controller:"thesisDefense",
	})
	$stateProvider.state("thesis.degreeApply",{
		url:"/degreeApply",
		templateUrl:"../view/thesis/degreeApply.html",
		controller:"degreeApply",
	})
	$stateProvider.state("thesis.counselor",{
		url:"/counselor",
		templateUrl:"../view/thesis/counselor.html",
		controller:"counselor",
	})
	$stateProvider.state("library",{
		url:"/library",
		templateUrl:"../view/library/index.html",
		controller:"library",
	})
	$stateProvider.state("examTicket",{
		url:"/examTicket",
		templateUrl:"../view/examTicket/examTicket.html",
		controller:"examTicket",
	})
	$stateProvider.state("examOnline",{
		url:"/examOnline/:id",
		templateUrl:"../view/other/examOnline.html",
		controller:"examOnline",
	})
	$stateProvider.state("footerDetail",{
		url:"/footerDetail/:id",
		templateUrl:"../view/footerDetail/index.html",
		controller:"footerDetail",
	})
})
app.run(function($rootScope,$state,$cookies,$cookieStore){
	$rootScope.host="http://test.huabote.com.cn:80"
	$rootScope.$on("$stateChangeSuccess",function(evt,toState,roParams,fromState){
		// $rootScope.currentState=toState.name;
		// $rootScope.arr=$rootScope.currentState.split(".")
		// console.log($rootScope.arr);
		$rootScope.questionData={};
	})	
	// $rootScope.toastMsg="提交成功!"
	$rootScope.toastShow=false;
})
//数字转时间过滤器
app.filter("toTime",function(){
	return function(num){
		var second=num%60;
		var minute=parseInt(num/60);
		var hour=parseInt(minute/60);
		if(second/10<1){
			second="0"+second;
		}
		if(minute/10<1){
			minute="0"+minute;
		}
		if(hour/10<1){
			hour="0"+hour;
		}
		return hour+":"+minute+":"+second;
	}
})
app.filter("haomiao",function(){
	return function(num){
		var time =num.replace(new RegExp("-","gm"),"/");
   		time = (new Date(time)).getTime();
		return time;
	}	
})